home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #2 / Ham Radio 2000 - Volume 2.iso / HAMV2 / ANTENNA / YAGIU112 / VSWR.C < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-07  |  420 b   |  26 lines

  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. #include <errno.h>
  5. #include "yagi.h"
  6. extern int errno;
  7.  
  8.  
  9. /* We calculate the vswr, given the magnitude of the reflection 
  10. coefficient */ 
  11. double calculate_vswr(double magnitude)
  12. {
  13.     double swr;
  14.     if(magnitude > 0.98 )
  15.         magnitude=0.98;
  16.     swr=(1+magnitude)/(1-magnitude);
  17. #ifdef DEBUG
  18.     if(errno)
  19.     {
  20.         fprintf(stderr,"Errno =%d in vswr.c\n", errno);
  21.         exit(1);
  22.     }
  23. #endif
  24.     return(swr);
  25. }
  26.